package org.example.liuy;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

@Slf4j
public class Application {

    public static void main(String[] args) {
        try {
            // 设置默认日志级别（如果使用Simple实现）
//            System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
//            System.setProperty("org.slf4j.simpleLogger.showDateTime", "true");
//            System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "yyyy-MM-dd HH:mm:ss.SSS");
//            System.setProperty("org.slf4j.simpleLogger.showThreadName", "true");
//            System.setProperty("org.slf4j.simpleLogger.showLogName", "true");
//            System.setProperty("org.slf4j.simpleLogger.showShortLogName", "true");
            // 启动服务时配置更多线程
            System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "400");
            int port = args.length > 0 ? Integer.parseInt(args[0]) : 8080;
            MyHttpService service = new MyHttpService(port);
            service.start();
            System.out.println("my http service started on port " + port);
        } catch (IOException e) {
            log.error("Error starting the service: " + e.getMessage());
        }
    }
}
